package com.ikkong.common.controller;

import com.alibaba.fastjson.JSONObject;
import com.ikkong.common.interceptor.ApiInterceptor;
import com.ikkong.common.model.Site;
import com.ikkong.common.service.ActiveRecordPluginService;
import com.ikkong.core.base.BaseController;
import com.jfinal.aop.Before;

@Before({ApiInterceptor.class })
public class ConfigController extends BaseController {

	//动态管理数据库和系统资源接口
	public void operation(){
		String data = getPara("data");
        Site site = JSONObject.parseObject(data, Site.class);
        
        if(site.isStateOn())
            ActiveRecordPluginService.me.add(site);
        
        else if(site.isStateOff())
            ActiveRecordPluginService.me.del(site);
        
        renderJson(ApiInterceptor.errJson(site));
	}
}
